home *** CD-ROM | disk | FTP | other *** search
- ;-------T-------T------------------------T----------------------------------;
- ;Random Plot
- ;-----------
- ;This is a graphical demonstration of the Random() functions. The default
- ;is to use FastRandom, but you can change it to SlowRandom if you look
- ;below.
- ;
- ;LMB exits.
-
- INCDIR "INCLUDES:"
- INCLUDE "games/games_lib.i"
- INCLUDE "games/games.i"
-
- Random = _LVOFastRandom ;_LVOFastRandom() or _LVOSlowRandom().
-
- CALL MACRO
- jsr _LVO\1(a6)
- ENDM
-
- SECTION "RandomPlot",CODE
-
- ;===========================================================================;
- ; INITIALISE DEMO
- ;===========================================================================;
-
- STARTGMS
-
- Start: MOVEM.L A0-A6/D1-D7,-(SP)
- move.l GMSBase(pc),a6
- CALL AllocBlitter
- tst.l d0
- bne.s .Error_Blitter
-
- lea ScreenTags(pc),a0
- CALL ShowScreen
- tst.l d0
- beq.s .Error_Screen
-
- bsr.s Main
-
- .ReturnToDOS
- move.l GMSBase(pc),a6
- move.l Screen(pc),a0
- CALL DeleteScreen
- .Error_Screen
- CALL FreeBlitter
- .Error_Blitter
- MOVEM.L (SP)+,A0-A6/D1-D7
- moveq #ERR_OK,d0
- rts
-
- ;===========================================================================;
- ; MAIN LOOP
- ;===========================================================================;
-
- Main: move.l GMSBase(pc),a6
- move.l Screen(pc),a0
- .loop moveq #JPORT1,d0
- CALL ReadMouse
- btst #MB_LMB,d0
- bne.s .done
-
- move.l GS_AmtColours(a0),d1 ;Get random colour.
- subq.l #1,d1
- jsr Random(a6) ;>> = Get random number.
- addq.l #1,d0
- move.l d0,d3 ;d3 = Colour to use.
-
- move.w GS_ScrWidth(a0),d1 ;Get random X.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d4 ;d4 = Store X to use.
-
- move.w GS_ScrHeight(a0),d1 ;Get random Y.
- jsr Random(a6) ;>> = Get random number.
- move.w d0,d2 ;d2 = Y to use.
- move.w d4,d1 ;d1 = Get back X.
-
- moveq #BUFFER1,d0
- CALL DrawUCPixel
- CALL AutoSwitch
- bra.s .loop
-
- .done rts
-
- ;===========================================================================;
- ; DATA
- ;===========================================================================;
-
- ScreenTags:
- dc.l TAGS_GAMESCREEN
- Screen: dc.l 0
- dc.l GSA_Palette,.palette
- dc.l GSA_AmtColours,32
- dc.l GSA_ScrWidth,640
- dc.l GSA_ScrHeight,512
- dc.l GSA_ScrMode,HIRES|LACED
- dc.l TAGEND
- .palette
- dc.l $000000,$109000,$F0C0B0,$F0A090,$D08080,$906050,$604040,$201010
- dc.l $400060,$404040,$F0F000,$403020,$C0C000,$109000,$500010,$808000
- dc.l $206010,$207010,$308020,$409020,$50A030,$50B040,$607070,$60C040
- dc.l $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020,$700010,$600010
-
-